CapitalGainResult

class CapitalGainResult @JvmOverloads constructor(val secAcct: Account?, val asOfDateInt: Int?, val selectedDateRange: DateRange?, val totSaleShares: Long, val totSaleSharesShort: Long, val totSaleSharesLong: Long, val totSaleSharesAvailable: Long, val totSaleSharesAvailableShort: Long, val totSaleSharesAvailableLong: Long, val totSaleValue: Long, val totSaleValueShort: Long, val totSaleValueLong: Long, val totSaleBasis: Long, val totSaleBasisShort: Long, val totSaleBasisLong: Long, val totSaleGains: Long, val totSaleGainsShort: Long, val totSaleGainsLong: Long, val isValid: Boolean, val isSimpleResult: Boolean, val isCompleteResult: Boolean, val txn: SplitTxn?, val errorMessageKey: String?, val useTaxDate: Boolean = false, val selectSalesByTaxDate: Boolean = false)

Tracks the result of a capital gain computation, including both short term and long term gains. The class is immutable. Updated by Stuart Beesley February 2024 - since MD2024(5100) to allow a more 'complete' set of values to be stored along with the updated CostCalculation class. WARNING: Check isValid() before using results. If not valid then you should assume zeros and no gain calculation!

Author

Sean Reilly & Stuart Beesley

Since

2024-02-01

Constructors

Link copied to clipboard
constructor(secAcct: Account?, asOfDateInt: Int?, selectedDateRange: DateRange?, totSaleShares: Long, totSaleSharesShort: Long, totSaleSharesLong: Long, totSaleSharesAvailable: Long, totSaleSharesAvailableShort: Long, totSaleSharesAvailableLong: Long, totSaleValue: Long, totSaleValueShort: Long, totSaleValueLong: Long, totSaleBasis: Long, totSaleBasisShort: Long, totSaleBasisLong: Long, totSaleGains: Long, totSaleGainsShort: Long, totSaleGainsLong: Long, isValid: Boolean, isSimpleResult: Boolean, isCompleteResult: Boolean, txn: SplitTxn?, errorMessageKey: String?, useTaxDate: Boolean = false, selectSalesByTaxDate: Boolean = false)
constructor(errorKey: String)

Constructor - invalid result with an error message.

constructor(txn: SplitTxn?, errorKey: String, useTaxDate: Boolean = false, selectSalesByTaxDate: Boolean = false)

Constructor - invalid result with an error message.

constructor(basis: Long, shortTermBasis: Long, longTermBasis: Long, shortTermShares: Long, longTermShares: Long, shortTermAvailShares: Long, longTermAvailShares: Long, messageKey: String?)

Constructor - valid (simple) result with an optional message key.

constructor(txn: SplitTxn?, basis: Long, shortTermBasis: Long, longTermBasis: Long, shortTermShares: Long, longTermShares: Long, shortTermAvailShares: Long, longTermAvailShares: Long, messageKey: String?)

Constructor - valid (simple) result with an optional message key.

constructor(secAcct: Account, asOfDateInt: Int?, selectedDateRange: DateRange?, totSaleShares: Long, totSaleSharesShort: Long, totSaleSharesLong: Long, totSaleSharesAvailable: Long, totSaleSharesAvailableShort: Long, totSaleSharesAvailableLong: Long, totSaleValue: Long, totSaleValueShort: Long, totSaleValueLong: Long, totSaleBasis: Long, totSaleBasisShort: Long, totSaleBasisLong: Long, totSaleGains: Long, totSaleGainsShort: Long, totSaleGainsLong: Long, messageKey: String?)

Constructor - valid (complete) result with an optional message key.

constructor(txn: SplitTxn?, secAcct: Account, asOfDateInt: Int?, selectedDateRange: DateRange?, totSaleShares: Long, totSaleSharesShort: Long, totSaleSharesLong: Long, totSaleSharesAvailable: Long, totSaleSharesAvailableShort: Long, totSaleSharesAvailableLong: Long, totSaleValue: Long, totSaleValueShort: Long, totSaleValueLong: Long, totSaleBasis: Long, totSaleBasisShort: Long, totSaleBasisLong: Long, totSaleGains: Long, totSaleGainsShort: Long, totSaleGainsLong: Long, messageKey: String?)

Constructor - valid (complete) result with an optional message key.

Properties

Link copied to clipboard
Link copied to clipboard
val basis: Long
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

true when the sale(s) were selected by tax date - a sale's tax date, not its transaction date, fell within the date range asked for. Default false. @since MD2027

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

The three 'available' fields (this one, totSaleSharesAvailableShort, totSaleSharesAvailableLong) are only calculated for average cost securities, and only when CostCalculation.CALCULATE_AVG_COST_DOUBLE_CATEGORY is on. Otherwise all three are 0 (lot-based securities gave -1 before MD2027).

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

true when the calculation used tax dates for the long/short term split (and for the order of a gains list). Default false. @since MD2027

Functions

Link copied to clipboard
open override fun toString(): String